import os
import sys
import hashlib
from functions import get_digest

argv = sys.argv
diretory = argv[1]
files = os.listdir(diretory)
files.sort(reverse=True)
os.system('mkdir '+diretory+'\\repeatfiles')
# print(files)
registry = dict()
for i in files:
	name = diretory+'\\'+i
	if not os.path.isfile(name):
		continue
	d = get_digest(name)
	if registry.get(d):
		os.system('move \"%s\" \"%s\\repeatfiles\\%s\"'%(name,diretory,i))
	registry[d] = name
os.system('pause')









